package eclipse.weibo.service;

import java.util.List;

import weibo4j.Status;

import eclipse.weibo.util.WeiboUtil;

public class ReadStatusThread extends Thread {
    private MyObservable ob;
    private int i;
    private int type;

    public ReadStatusThread(MyObservable ob, int i, int type) {
        this.ob = ob;
        this.i = i;
        this.type = type;
    }

    public void run() {
        List<Status> list = null;
        if (this.type == 0) {
            if (this.i == 0) {
                list = WeiboUtil.getFriendsTimeline();
            } else if (this.i == 1) {
                list = WeiboUtil.getFriendsTimelineNextPage();
            } else if (this.i == -1) {
                list = WeiboUtil.getFriendsTimelineLastPage();
            }
        } else if (this.type == 1) {
            if (this.i == 0) {
                list = WeiboUtil.getMyWeibo(0);
            } else if (this.i == 1) {
                list = WeiboUtil.getMyWeibo(1);
            } else if (this.i == -1) {
                list = WeiboUtil.getMyWeibo(-1);
            }
        } else if (this.type == 2) {
            if (this.i == 0) {
                list = WeiboUtil.getAtMyWeiboList(0);
            } else if (this.i == 1) {
                list = WeiboUtil.getAtMyWeiboList(1);
            } else if (this.i == -1) {
                list = WeiboUtil.getAtMyWeiboList(-1);
            }
        }

        this.ob.notifyObservers(list);
    }
}
